﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebBanHang.Models;

namespace WebBanHang.Controllers
{
    public class TinTucController : Controller
    {
        WebBanHang.Models.HNCSolutionsEntities db = new Models.HNCSolutionsEntities();
        //
        // GET: /TinTuc/

        public ActionResult Index(int soluongTin = 10)
        {
            var model = db.TinTucs.Take(soluongTin).ToList();
            return View(model);
        }

        public PartialViewResult _TinTuc(int soluongTin = 10)
        {
            WebBanHang.Models.HNCSolutionsEntities dataContext = new Models.HNCSolutionsEntities();
            var model = dataContext.TinTucs.Take(soluongTin).ToList();
            return PartialView(model);
        }

        public ActionResult Detail(int id)
        {
            TinTuc tinTuc = db.TinTucs.Find(id);
            if (tinTuc == null)
            {
                return HttpNotFound();
            }

            return View("ChiTiet" ,tinTuc);
        }
    }
}
